
<?php

switch ($_SERVER['REQUEST_METHOD']) {
case 'GET':
	new_lecture_GET();
	break;

case 'POST':
	new_lecture_POST();
	break;
default:
	break;
}


function new_lecture_GET() {
	global $woodb;
	if (isset($_REQUEST['course_id'])) {
		$course_id = $_REQUEST['course_id'];
		$courses = $woodb->getCourseByID($course_id);
		if ($courses != NULL) {
			$course = $courses[0];
	?>
	<script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
	<div class="wrap">
		<h2>Add Lecture</h2>
		<div class='woo_breadcrumbs'>
		<a href='?page=woodle_admin'>Courses</a> &raquo; 
		<a href='?page=woodle_admin&action=woodle_edit_course&course_id=<?=$course->course_id?>'><?=($course->name." (".$course->semester." ".$course->year.")")?></a> &raquo; 
		New Lecture
		</div>
		<form method="post" action="admin.php?page=woodle_admin&action=woodle_edit_lecture">
			<input type="hidden" name="course_id" id="course_id" value="<?=$course_id?>" />
			<div id="titlediv">
				<div id="titlewrap">
					<div style="float:left; margin-right: 20px">
						<h3>Title</h3>
						<input type="text" autocomplete="off" id="lecture_title" value="" tabindex="1" size="30" name="lecture_title">
					</div>
					<div style="float:left;  margin-right: 20px">
						<h3>Date</h3>
						<input type="text" autocomplete="off" id="lecture_date" value="" tabindex="1" size="30" name="lecture_date">
					</div>
				</div>
			</div>
			<div style="clear:both; padding-top: 20px">
				<h3>Course Description</h3>
				<div class="form-table">
					<?php
						$args = array("textarea_name" => "lecture_description");
						wp_editor( '', "lecture_description", $args );
					?>
				</div>
			</div>
			
			<p class="submit">
			<input type="submit" class="button-primary" value="Save Lecture" />
			</p>
		</form>
	<?php
		} else {
			?><div class="updated below-h2" id="message"><p>Lecture does not exist</p></div><?php
		}
	} else {
		?><div class="updated below-h2" id="message"><p>Invalid parameters</p></div><?php
	}
}

function new_lecture_POST() {
}
?>